Two ways: display data through tables or graphs.
Depends on the purpose.
ggplot2ggplot2 package (Wickham 2016).ggplot2 basicsUsing ggplot2 to generate a basic plot in R is quite simple. Three key points:
data.frame/tibble (in tidy format!).ggplot().ggplot(data = my_dataframe, aes(x= xvar, y= yvar))
ggplot2: building plots layer by layerggplot(data = swiss, aes(x = Education, y = Examination))
ggplot2: building plots layer by layerggplot(data = swiss, aes(x = Education, y = Examination)) + geom_point(aes(color = Agriculture)) + geom_smooth(method = 'lm') + facet_wrap(~Religion)
## `geom_smooth()` using formula = 'y ~ x'
tidyverse: tools to help you with every part of the data pipeline.tidyverse: tools to help you with every part of the data pipeline.
In recent years, and especially in the post-COVID time, the psychological health of the Swiss population has deteriorated. This is especially true for people in the younger age groups, especially for women. For more information, see OBSAN 2023 (Obsan_03_2023_BERICHT.pdf (admin.ch)).
You are interested in understanding the financial consequences of deteriorating psychological health. You will use health insurance claim data from SWICA, a leading Swiss health insurance.
You receive two datasets containing aggregated data:
“stamm” data: this dataset contains basic information about the population insured in the base mandatory health plan at SWICA between 2020 and 2021.
“medi” data: this dataset contains the aggregated number of psychological consultations and related costs.
Use these data to answer the following questions.
Note: these data are confidential. They cannot be used outside of this classroom. They have been modified to preserve confidentiality.
. . *** **
! . ._*. .
- -*- - .-'-. ! ! .
. . * .-' .-. '-.! ! . .
*** .-' .-' '-. '-.! .
* ***.-' .-' '-. '-. .
* ***$*.-' '-. '-. *
* *** * *** ___________ !-..!-. * * * *
* *** **$** * !__!__!__!__! ! ! *** *** . * ***
*** **** * ***** !__!__!__!__! ! .***-.-*** * *** * #_
********** * ****$ * !__!__!__!__! !-..--'***** # '*-..---# ***
**** ***** * $** *** . ! ***** *** ***
************ ***** ***-..-' -.._________! ******* *** *****
*********** .-#.-' '-.-''-..! ******* ****... #
# ''-.---'' '-....---#..--'****** ''-.---''-
Merry Christmas #
_` | __ \ _` | _` | __ \ _` | __ \ __ \ | |
( | | | | ( | ( | | | | ( | | | | | | |
\__,_|_| |_|\__,_| \__,_| _| |_|\__,_| .__/ .__/ \__, |
_| _| ____/
\ | \ \ / |
\ | _ \ \ \ / \ / _ \ _` | __| |
|\ | __/\ \ \ / | __/ ( | | _|
_| \_|\___| \_/\_/ _|\___|\__,_|_| _)
Wickham, Hadley. 2016. Ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. http://ggplot2.org.